
<include file="mobile/Public/header" />


<link rel="stylesheet" href="__CSS__/detail_font.css">
<link rel="stylesheet" href="__CSS__/makeorder.css">
<header class="color-main vertical-box">
    <span class="header-title">收货地址</span>
    <div class="header-left vertical-box">
        <img class="img-btn" src="__IMG__/back.png" onclick="history.back()">
    </div>
    <div class="header-right vertical-box">
        <img class="img-btn" src="__IMG__/home.png" onclick="window.location.href='{:U('shop/index/index')}'">
    </div>
</header>
<article class="address-article btn-footer-margin">
    <php>
    if(!empty($address['list'])){
        foreach ($address['list'] as $a) {
            </php>
            <section class="linear-section margin-top-section margin-top-section last-liner-section" data-id="<php> echo $a['id'] </php>">
                <div class="select-address linear-address-section border-box">
                    <p class="big-text">
                        <span class="detail-icon-user active-font"></span><span class="address-user"><php> echo $a['name'] </php></span>
                        <span class="detail-icon-phone2 active-font"></span><php> echo $a['phone'] </php></p>
                    <p class="small-text tips-font">
                        <php>
                        $full_address='';
                        if(!empty($a['province'])) $full_address.=$a['province'];
                        if(!empty($a['town'])) $full_address.=$a['town'];
                        if(!empty($a['city'])) $full_address.=$a['city'];
                        if(!empty($a['address'])) $full_address.=$a['address'];
                        echo $full_address;
                        </php>
                    </p>
                </div>
                <span class="func-btn linear-right vertical-box " onclick="window.location.href='{:U('shop/index/addaddress')}&id=<php> echo $a['id'] </php>'"  data-id="">
	                <span>
                      <img src="__IMG__/edit.png">
                    </span>
                </span>
            </section>
    <php>
        }
    }
    else{
        </php>
        <p class="margin-top big-text white-tips-font" style="text-align: center">还没有地址，添加一个吧</p>
    <php>
    }
    </php>
</article>
<footer class="btn-footer footer-one-btn">
    <button class="color-primary big-text" onclick="window.location.href='{:U('shop/index/addaddress')}'">新增收货地址</button>
</footer>

<include file="mobile/Public/footer" />

<script>
    var addressType = '<php> echo(!empty($type)? ($type):"null")</php>';
    //'jquery' or 'zepto' 脚本入口,按情况选择加载
    seajs.use('zepto', function () {
        $(document).ready(function () {
            /*选择模式的地址列表*/
            seajs.use('zepto_cookie', function () {
                /*添加后刷新缓存*/
                var freshen_data = $.fn.cookie('freshen_add_data');
                if(freshen_data=='true'){
                    $.fn.cookie('freshen_add_data','false');
                    window.location.reload()
                }
                if(addressType=='select'){
                    $('.address-article .func-btn').hide();
                    $('.address-article .select-address').click(function () {
                        var id = $(this).parent().data('id');
                        $.post('{:U('shop/index/addaddress')}',{id:id,select:1}, function (ret) {
//		                    console.log(ret)
//		                    return
                            /*记录刷新标志*/
                            $.fn.cookie('freshen_data','true');
                            history.back()
                        })
                    })
                }
            });

        })
    });
</script>
</body>
</html>